package com.ruoyi.finance.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.finance.domain.AccountsPayable;
import com.ruoyi.finance.mapper.AccountsPayableMapper;
import com.ruoyi.finance.service.IAccountsPayableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 应付账款Service业务层处理
 * 
 * @author liuyu
 * @date 2024-10-28
 */
@Service
public class AccountsPayableServiceImpl implements IAccountsPayableService 
{
    @Autowired
    private AccountsPayableMapper accountsPayableMapper;

    /**
     * 查询应付账款
     * 
     * @param id 应付账款主键
     * @return 应付账款
     */
    @Override
    public AccountsPayable selectAccountsPayableById(Long id)
    {
        return accountsPayableMapper.selectAccountsPayableById(id);
    }

    /**
     * 查询应付账款列表
     * 
     * @param accountsPayable 应付账款
     * @return 应付账款
     */
    @Override
    public List<AccountsPayable> selectAccountsPayableList(AccountsPayable accountsPayable)
    {
        return accountsPayableMapper.selectAccountsPayableList(accountsPayable);
    }

    /**
     * 新增应付账款
     * 
     * @param accountsPayable 应付账款
     * @return 结果
     */
    @Override
    public int insertAccountsPayable(AccountsPayable accountsPayable)
    {
        accountsPayable.setCreateTime(DateUtils.getNowDate());
        return accountsPayableMapper.insertAccountsPayable(accountsPayable);
    }

    /**
     * 修改应付账款
     * 
     * @param accountsPayable 应付账款
     * @return 结果
     */
    @Override
    public int updateAccountsPayable(AccountsPayable accountsPayable)
    {
        accountsPayable.setUpdateTime(DateUtils.getNowDate());
        return accountsPayableMapper.updateAccountsPayable(accountsPayable);
    }



    /**
     * 删除应付账款信息
     * 
     * @param id 应付账款主键
     * @return 结果
     */
    @Override
    public int deleteAccountsPayableById(Long id)
    {
        return accountsPayableMapper.deleteAccountsPayableById(id);
    }
}
